package cn.jorian.framework.bean;

import cn.jorian.framework.enumcode.CodeEnum;

public class ResponseResult<T> {

    private String success;

    private String code;

    private String message;

    private T data;

    public ResponseResult() {
    }

    public ResponseResult(String success, String code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    public ResponseResult(String success, String code, String message, T data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public String getSuccess() {
        return success;
    }

    public void setSuccess(String success) {
        this.success = success;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static ResponseResult success() {
        ResponseResult result = new ResponseResult();
        result.success = "true";
        result.code = CodeEnum.SUCCESS.getCode();
        result.message = CodeEnum.SUCCESS.getMessage();
        return result;
    }

    public static ResponseResult fail(String message) {
        ResponseResult result = new ResponseResult();
        result.success = "fail";
        result.code = CodeEnum.ILLEGALITY.getCode();
        result.message = message;
        return result;
    }

}
